﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
using System.Threading;

namespace Supply_Fetch.MUILayer
{
    public delegate void GUIEventSubscription(object action);

    class GUI : Form
    {
        private System.ComponentModel.IContainer components;
        private Label PresentFeedback;
        public event GUIEventSubscription guiEventSubscription;
        private Panel MainPanel;
        private Panel InventoryOptionsPanel;
        private Panel HardwareOptionsPanel;
        private Button IndicateLED1;
        private ListBox InventoryListBox;
        private Panel ViewControlPanel;
        private Button ToHardwareViewButton;
        private Button ToInventoryViewButton;
        private Button ToMicrophoneViewButton;

        public const int TestAllLightsCode = 0;

        private int IndicationTime;
        private int FeedbackTime;
        private int MaxRows;
        private int MaxCols;

        private Button SearchItemsButton;
        private TextBox SearchBox;
        public System.ComponentModel.BackgroundWorker ledIndicationWorker;
        private Label TestLED1Label;
        private DrawerTable drawerTable;
        private Drawer[] drawers;

        private string[] itemNames;
        private Label ItemRequest;
        private Label InventoryManagment;
        private Label SystemMaintanence;
        private Button ListAllItems;
        private Button Delete;
        private Button Move;
        private Button AddItem;

        private LEDList LEDlist = new LEDList();

        public System.ComponentModel.BackgroundWorker speechRecognitionWorker;

        private Panel AddItemPanel;
        private TextBox AddItemEntry;
        private Label AddItemLabel;

        private string[][] itemLocations;
        private Panel SpeakNowPanel;
        private Button CancelRecognitionButton1;
        private Panel NoMatchFoundPanel;
        private Panel ActivateSpeechPanel;
        private Button CancelRecognitionButton2;
        private Button SpeakAgainButton;
        private Button ActivatListenButton1;
        private Panel IndicationProcessPanel;
        private ProgressBar IndicationProgressBar;
        private Label TestLED3Label;
        private Button exitButton;
        private Panel GUIControlPanel;
        private ContextMenuStrip contextMenuStrip1;
        private Button ToReportViewButton;
        private Panel ReportViewPanel;
        private Label ReportLabel;
        public RadioButton TwentytwoSecondRadioButton;
        public RadioButton NineteenSecondRadioButton;
        public RadioButton SixteenSecondsRadioButton;
        public RadioButton ThirteenSecondRadioButton;
        private ComboBox NoMatchesCombobox;
        private Button FindItemAlternate;
        private Label SelectDrawerLabel;
        private Label RefreshReportLabel;
        private Microsoft.VisualBasic.PowerPacks.ShapeContainer shapeContainer1;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape5;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape4;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape3;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape2;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape1;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape9;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape8;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape7;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape6;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape11;
        private Microsoft.VisualBasic.PowerPacks.LineShape lineShape10;
        private Label label1;
        private Label label2;
        private ColumnLightSelector columnLightSelector;
        private Button minimizeGUI;
        private ToolTip ButtonTip;
        private CrystalDecisions.Windows.Forms.CrystalReportViewer crystalReportViewer2;
        private string currentSelectedItem;

        public GUI()
        {

            this.InitializeComponent();

            this.defineMatrixSize();
            this.drawerTable.buildTable(this.MaxRows, this.MaxCols);
            this.columnLightSelector.BuildColumnSelector(this.MaxCols);

            this.ReportViewPanel.Hide();
            this.InventoryOptionsPanel.Hide();
            this.HardwareOptionsPanel.Hide();
            this.MainPanel.Show();
            this.NoMatchFoundPanel.Hide();
            this.SpeakNowPanel.Hide();
            this.IndicationProcessPanel.Hide();
            this.ActivateSpeechPanel.Show();
            this.ToMicrophoneViewButton.Enabled = false;
            this.Delete.Enabled = false;
            this.Move.Enabled = false;
            this.GUIControlPanel.BringToFront();

            #region Fixing buttons on ViewControlPanel to exact center of primary screen.

            int buttonSpacing = 30;
            int buttonSize = this.ToMicrophoneViewButton.Width;
            int midpoint = Screen.PrimaryScreen.Bounds.Width / 2;
            int buttonYPos = this.ViewControlPanel.Height / 2 - this.ToMicrophoneViewButton.Height / 2;

            Console.WriteLine(this.MaximumSize.Width);

            this.ToMicrophoneViewButton.Location = new Point( midpoint - ( ((3 * buttonSpacing) / 2) + (2 * buttonSize) ), buttonYPos);
            this.ToInventoryViewButton.Location = new Point( midpoint - ( (buttonSpacing / 2) + buttonSize ), buttonYPos);
            this.ToHardwareViewButton.Location = new Point( midpoint + (buttonSpacing / 2), buttonYPos);
            this.ToReportViewButton.Location = new Point( midpoint + ( ((3 * buttonSpacing) / 2) + buttonSize ), buttonYPos);

            #endregion

            this.DefineIndicationTime();
            this.FeedbackTime = this.IndicationTime;
        }

        /// <summary>
        /// This performs the setup procedure of defining the maximum row and maximum columns for the mapping matrix.
        /// </summary>
        private void defineMatrixSize()
        {
            this.MaxRows = 4;
            this.MaxCols = 11;
        }

        /// <summary>
        /// This performs the setup procedure for defining the indication time.
        /// </summary>
        private void DefineIndicationTime()
        {
            this.IndicationTime = 6000;
        }

        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(GUI));
            this.MainPanel = new System.Windows.Forms.Panel();
            this.ActivateSpeechPanel = new System.Windows.Forms.Panel();
            this.ActivatListenButton1 = new System.Windows.Forms.Button();
            this.SpeakNowPanel = new System.Windows.Forms.Panel();
            this.CancelRecognitionButton1 = new System.Windows.Forms.Button();
            this.ItemRequest = new System.Windows.Forms.Label();
            this.NoMatchFoundPanel = new System.Windows.Forms.Panel();
            this.FindItemAlternate = new System.Windows.Forms.Button();
            this.NoMatchesCombobox = new System.Windows.Forms.ComboBox();
            this.SpeakAgainButton = new System.Windows.Forms.Button();
            this.CancelRecognitionButton2 = new System.Windows.Forms.Button();
            this.IndicationProcessPanel = new System.Windows.Forms.Panel();
            this.IndicationProgressBar = new System.Windows.Forms.ProgressBar();
            this.PresentFeedback = new System.Windows.Forms.Label();
            this.GUIControlPanel = new System.Windows.Forms.Panel();
            this.minimizeGUI = new System.Windows.Forms.Button();
            this.exitButton = new System.Windows.Forms.Button();
            this.InventoryOptionsPanel = new System.Windows.Forms.Panel();
            this.ListAllItems = new System.Windows.Forms.Button();
            this.Delete = new System.Windows.Forms.Button();
            this.Move = new System.Windows.Forms.Button();
            this.InventoryManagment = new System.Windows.Forms.Label();
            this.drawerTable = new Supply_Fetch.DrawerTable();
            this.SearchItemsButton = new System.Windows.Forms.Button();
            this.SearchBox = new System.Windows.Forms.TextBox();
            this.InventoryListBox = new System.Windows.Forms.ListBox();
            this.AddItemPanel = new System.Windows.Forms.Panel();
            this.AddItemEntry = new System.Windows.Forms.TextBox();
            this.AddItem = new System.Windows.Forms.Button();
            this.AddItemLabel = new System.Windows.Forms.Label();
            this.SelectDrawerLabel = new System.Windows.Forms.Label();
            this.HardwareOptionsPanel = new System.Windows.Forms.Panel();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.ThirteenSecondRadioButton = new System.Windows.Forms.RadioButton();
            this.TwentytwoSecondRadioButton = new System.Windows.Forms.RadioButton();
            this.columnLightSelector = new Supply_Fetch.ColumnLightSelector();
            this.SixteenSecondsRadioButton = new System.Windows.Forms.RadioButton();
            this.SystemMaintanence = new System.Windows.Forms.Label();
            this.NineteenSecondRadioButton = new System.Windows.Forms.RadioButton();
            this.ViewControlPanel = new System.Windows.Forms.Panel();
            this.ToReportViewButton = new System.Windows.Forms.Button();
            this.ToHardwareViewButton = new System.Windows.Forms.Button();
            this.ToInventoryViewButton = new System.Windows.Forms.Button();
            this.ToMicrophoneViewButton = new System.Windows.Forms.Button();
            this.ledIndicationWorker = new System.ComponentModel.BackgroundWorker();
            this.speechRecognitionWorker = new System.ComponentModel.BackgroundWorker();
            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.ReportViewPanel = new System.Windows.Forms.Panel();
            this.crystalReportViewer2 = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
            this.RefreshReportLabel = new System.Windows.Forms.Label();
            this.ReportLabel = new System.Windows.Forms.Label();
            this.shapeContainer1 = new Microsoft.VisualBasic.PowerPacks.ShapeContainer();
            this.lineShape11 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape10 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape9 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape8 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape7 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape6 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape5 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape4 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape3 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape2 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.lineShape1 = new Microsoft.VisualBasic.PowerPacks.LineShape();
            this.ButtonTip = new System.Windows.Forms.ToolTip(this.components);
            this.MainPanel.SuspendLayout();
            this.ActivateSpeechPanel.SuspendLayout();
            this.SpeakNowPanel.SuspendLayout();
            this.NoMatchFoundPanel.SuspendLayout();
            this.IndicationProcessPanel.SuspendLayout();
            this.GUIControlPanel.SuspendLayout();
            this.InventoryOptionsPanel.SuspendLayout();
            this.AddItemPanel.SuspendLayout();
            this.HardwareOptionsPanel.SuspendLayout();
            this.ViewControlPanel.SuspendLayout();
            this.ReportViewPanel.SuspendLayout();
            this.SuspendLayout();
            // 
            // MainPanel
            // 
            this.MainPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.MainPanel.AutoSize = true;
            this.MainPanel.BackColor = System.Drawing.SystemColors.ControlDarkDark;
            this.MainPanel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("MainPanel.BackgroundImage")));
            this.MainPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.MainPanel.Controls.Add(this.ActivateSpeechPanel);
            this.MainPanel.Controls.Add(this.SpeakNowPanel);
            this.MainPanel.Controls.Add(this.ItemRequest);
            this.MainPanel.Controls.Add(this.NoMatchFoundPanel);
            this.MainPanel.Controls.Add(this.IndicationProcessPanel);
            this.MainPanel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.MainPanel.Location = new System.Drawing.Point(0, 0);
            this.MainPanel.Name = "MainPanel";
            this.MainPanel.Size = new System.Drawing.Size(1280, 719);
            this.MainPanel.TabIndex = 0;
            // 
            // ActivateSpeechPanel
            // 
            this.ActivateSpeechPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.ActivateSpeechPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.ActivateSpeechPanel.Controls.Add(this.ActivatListenButton1);
            this.ActivateSpeechPanel.Location = new System.Drawing.Point(417, 222);
            this.ActivateSpeechPanel.Name = "ActivateSpeechPanel";
            this.ActivateSpeechPanel.Size = new System.Drawing.Size(447, 364);
            this.ActivateSpeechPanel.TabIndex = 8;
            // 
            // ActivatListenButton1
            // 
            this.ActivatListenButton1.BackgroundImage = global::Supply_Fetch.Properties.Resources.activate_speech_recognition;
            this.ActivatListenButton1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.ActivatListenButton1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.ActivatListenButton1.Location = new System.Drawing.Point(0, 0);
            this.ActivatListenButton1.Name = "ActivatListenButton1";
            this.ActivatListenButton1.Size = new System.Drawing.Size(445, 362);
            this.ActivatListenButton1.TabIndex = 0;
            this.ActivatListenButton1.UseVisualStyleBackColor = true;
            this.ActivatListenButton1.Click += new System.EventHandler(this.ActivatListenButton1_Click);
            // 
            // SpeakNowPanel
            // 
            this.SpeakNowPanel.BackgroundImage = global::Supply_Fetch.Properties.Resources.speak_now;
            this.SpeakNowPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.SpeakNowPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.SpeakNowPanel.Controls.Add(this.CancelRecognitionButton1);
            this.SpeakNowPanel.Location = new System.Drawing.Point(417, 222);
            this.SpeakNowPanel.Name = "SpeakNowPanel";
            this.SpeakNowPanel.Size = new System.Drawing.Size(447, 364);
            this.SpeakNowPanel.TabIndex = 6;
            // 
            // CancelRecognitionButton1
            // 
            this.CancelRecognitionButton1.BackgroundImage = global::Supply_Fetch.Properties.Resources.cancel;
            this.CancelRecognitionButton1.Location = new System.Drawing.Point(0, 286);
            this.CancelRecognitionButton1.Name = "CancelRecognitionButton1";
            this.CancelRecognitionButton1.Size = new System.Drawing.Size(445, 76);
            this.CancelRecognitionButton1.TabIndex = 0;
            this.CancelRecognitionButton1.UseVisualStyleBackColor = true;
            this.CancelRecognitionButton1.Click += new System.EventHandler(this.CancelRecognitionButton1_Click);
            // 
            // ItemRequest
            // 
            this.ItemRequest.AutoSize = true;
            this.ItemRequest.BackColor = System.Drawing.Color.Transparent;
            this.ItemRequest.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.ItemRequest.ForeColor = System.Drawing.Color.White;
            this.ItemRequest.Location = new System.Drawing.Point(148, 82);
            this.ItemRequest.Name = "ItemRequest";
            this.ItemRequest.Size = new System.Drawing.Size(255, 46);
            this.ItemRequest.TabIndex = 4;
            this.ItemRequest.Text = "Item Request";
            // 
            // NoMatchFoundPanel
            // 
            this.NoMatchFoundPanel.BackgroundImage = global::Supply_Fetch.Properties.Resources.speak_no_matches_found;
            this.NoMatchFoundPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.NoMatchFoundPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.NoMatchFoundPanel.Controls.Add(this.FindItemAlternate);
            this.NoMatchFoundPanel.Controls.Add(this.NoMatchesCombobox);
            this.NoMatchFoundPanel.Controls.Add(this.SpeakAgainButton);
            this.NoMatchFoundPanel.Controls.Add(this.CancelRecognitionButton2);
            this.NoMatchFoundPanel.Location = new System.Drawing.Point(417, 222);
            this.NoMatchFoundPanel.Name = "NoMatchFoundPanel";
            this.NoMatchFoundPanel.Size = new System.Drawing.Size(447, 364);
            this.NoMatchFoundPanel.TabIndex = 7;
            // 
            // FindItemAlternate
            // 
            this.FindItemAlternate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.FindItemAlternate.ForeColor = System.Drawing.Color.White;
            this.FindItemAlternate.Location = new System.Drawing.Point(322, 80);
            this.FindItemAlternate.Name = "FindItemAlternate";
            this.FindItemAlternate.Size = new System.Drawing.Size(75, 23);
            this.FindItemAlternate.TabIndex = 4;
            this.FindItemAlternate.Text = "Locate";
            this.FindItemAlternate.UseVisualStyleBackColor = true;
            this.FindItemAlternate.Click += new System.EventHandler(this.NoMatchesCombobox_ItemSelected);
            // 
            // NoMatchesCombobox
            // 
            this.NoMatchesCombobox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.NoMatchesCombobox.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.NoMatchesCombobox.ForeColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.NoMatchesCombobox.FormattingEnabled = true;
            this.NoMatchesCombobox.Location = new System.Drawing.Point(45, 80);
            this.NoMatchesCombobox.Name = "NoMatchesCombobox";
            this.NoMatchesCombobox.Size = new System.Drawing.Size(269, 21);
            this.NoMatchesCombobox.Sorted = true;
            this.NoMatchesCombobox.TabIndex = 3;
            this.NoMatchesCombobox.Text = "Select an item from the list...";
            this.NoMatchesCombobox.Enter += new System.EventHandler(this.NoMatchesCombobox_Entered);
            this.NoMatchesCombobox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.EnterKeyHandler);
            // 
            // SpeakAgainButton
            // 
            this.SpeakAgainButton.BackgroundImage = global::Supply_Fetch.Properties.Resources.speak_again;
            this.SpeakAgainButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.SpeakAgainButton.Location = new System.Drawing.Point(-1, 286);
            this.SpeakAgainButton.Name = "SpeakAgainButton";
            this.SpeakAgainButton.Size = new System.Drawing.Size(222, 77);
            this.SpeakAgainButton.TabIndex = 1;
            this.SpeakAgainButton.UseVisualStyleBackColor = true;
            this.SpeakAgainButton.Click += new System.EventHandler(this.SpeakAgainButton_Click);
            // 
            // CancelRecognitionButton2
            // 
            this.CancelRecognitionButton2.BackgroundImage = global::Supply_Fetch.Properties.Resources.cancel2;
            this.CancelRecognitionButton2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.CancelRecognitionButton2.Location = new System.Drawing.Point(222, 286);
            this.CancelRecognitionButton2.Name = "CancelRecognitionButton2";
            this.CancelRecognitionButton2.Size = new System.Drawing.Size(223, 77);
            this.CancelRecognitionButton2.TabIndex = 2;
            this.CancelRecognitionButton2.UseVisualStyleBackColor = true;
            this.CancelRecognitionButton2.Click += new System.EventHandler(this.CancelRecognitionButton2_Click);
            // 
            // IndicationProcessPanel
            // 
            this.IndicationProcessPanel.BackgroundImage = global::Supply_Fetch.Properties.Resources.working;
            this.IndicationProcessPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.IndicationProcessPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.IndicationProcessPanel.Controls.Add(this.IndicationProgressBar);
            this.IndicationProcessPanel.Location = new System.Drawing.Point(417, 222);
            this.IndicationProcessPanel.Name = "IndicationProcessPanel";
            this.IndicationProcessPanel.Size = new System.Drawing.Size(447, 364);
            this.IndicationProcessPanel.TabIndex = 9;
            // 
            // IndicationProgressBar
            // 
            this.IndicationProgressBar.Location = new System.Drawing.Point(-1, 284);
            this.IndicationProgressBar.Maximum = 5;
            this.IndicationProgressBar.Name = "IndicationProgressBar";
            this.IndicationProgressBar.Size = new System.Drawing.Size(450, 79);
            this.IndicationProgressBar.TabIndex = 0;
            // 
            // PresentFeedback
            // 
            this.PresentFeedback.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.PresentFeedback.BackColor = System.Drawing.Color.Transparent;
            this.PresentFeedback.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.PresentFeedback.Font = new System.Drawing.Font("Calibri", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.PresentFeedback.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.PresentFeedback.Image = ((System.Drawing.Image)(resources.GetObject("PresentFeedback.Image")));
            this.PresentFeedback.Location = new System.Drawing.Point(322, 145);
            this.PresentFeedback.Name = "PresentFeedback";
            this.PresentFeedback.Size = new System.Drawing.Size(647, 36);
            this.PresentFeedback.TabIndex = 2;
            this.PresentFeedback.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            // 
            // GUIControlPanel
            // 
            this.GUIControlPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.GUIControlPanel.BackColor = System.Drawing.Color.Transparent;
            this.GUIControlPanel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("GUIControlPanel.BackgroundImage")));
            this.GUIControlPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.GUIControlPanel.Controls.Add(this.minimizeGUI);
            this.GUIControlPanel.Controls.Add(this.exitButton);
            this.GUIControlPanel.ForeColor = System.Drawing.Color.Transparent;
            this.GUIControlPanel.Location = new System.Drawing.Point(1089, 1);
            this.GUIControlPanel.Name = "GUIControlPanel";
            this.GUIControlPanel.Size = new System.Drawing.Size(190, 70);
            this.GUIControlPanel.TabIndex = 11;
            // 
            // minimizeGUI
            // 
            this.minimizeGUI.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("minimizeGUI.BackgroundImage")));
            this.minimizeGUI.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.minimizeGUI.Location = new System.Drawing.Point(51, 3);
            this.minimizeGUI.Name = "minimizeGUI";
            this.minimizeGUI.Size = new System.Drawing.Size(64, 64);
            this.minimizeGUI.TabIndex = 11;
            this.ButtonTip.SetToolTip(this.minimizeGUI, "Minimize");
            this.minimizeGUI.UseVisualStyleBackColor = true;
            this.minimizeGUI.Click += new System.EventHandler(this.minimizeGUI_Click);
            // 
            // exitButton
            // 
            this.exitButton.BackColor = System.Drawing.Color.Transparent;
            this.exitButton.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("exitButton.BackgroundImage")));
            this.exitButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.exitButton.ForeColor = System.Drawing.Color.Transparent;
            this.exitButton.Location = new System.Drawing.Point(123, 3);
            this.exitButton.Name = "exitButton";
            this.exitButton.Size = new System.Drawing.Size(64, 64);
            this.exitButton.TabIndex = 10;
            this.ButtonTip.SetToolTip(this.exitButton, "Exit");
            this.exitButton.UseVisualStyleBackColor = false;
            this.exitButton.Click += new System.EventHandler(this.close_Click);
            // 
            // InventoryOptionsPanel
            // 
            this.InventoryOptionsPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.InventoryOptionsPanel.BackColor = System.Drawing.Color.WhiteSmoke;
            this.InventoryOptionsPanel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("InventoryOptionsPanel.BackgroundImage")));
            this.InventoryOptionsPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.InventoryOptionsPanel.Controls.Add(this.ListAllItems);
            this.InventoryOptionsPanel.Controls.Add(this.Delete);
            this.InventoryOptionsPanel.Controls.Add(this.Move);
            this.InventoryOptionsPanel.Controls.Add(this.InventoryManagment);
            this.InventoryOptionsPanel.Controls.Add(this.drawerTable);
            this.InventoryOptionsPanel.Controls.Add(this.SearchItemsButton);
            this.InventoryOptionsPanel.Controls.Add(this.SearchBox);
            this.InventoryOptionsPanel.Controls.Add(this.InventoryListBox);
            this.InventoryOptionsPanel.Controls.Add(this.AddItemPanel);
            this.InventoryOptionsPanel.Controls.Add(this.SelectDrawerLabel);
            this.InventoryOptionsPanel.Location = new System.Drawing.Point(0, 0);
            this.InventoryOptionsPanel.Name = "InventoryOptionsPanel";
            this.InventoryOptionsPanel.Size = new System.Drawing.Size(1280, 719);
            this.InventoryOptionsPanel.TabIndex = 1;
            // 
            // ListAllItems
            // 
            this.ListAllItems.BackColor = System.Drawing.Color.DodgerBlue;
            this.ListAllItems.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.ListAllItems.FlatAppearance.BorderColor = System.Drawing.Color.White;
            this.ListAllItems.FlatAppearance.BorderSize = 0;
            this.ListAllItems.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.ListAllItems.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.ListAllItems.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.ListAllItems.ForeColor = System.Drawing.Color.White;
            this.ListAllItems.Location = new System.Drawing.Point(151, 515);
            this.ListAllItems.Name = "ListAllItems";
            this.ListAllItems.Size = new System.Drawing.Size(108, 32);
            this.ListAllItems.TabIndex = 9;
            this.ListAllItems.Text = "List All Items";
            this.ListAllItems.UseVisualStyleBackColor = false;
            this.ListAllItems.Click += new System.EventHandler(this.ListAllItems_Click);
            // 
            // Delete
            // 
            this.Delete.BackColor = System.Drawing.Color.DodgerBlue;
            this.Delete.FlatAppearance.BorderSize = 0;
            this.Delete.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.Delete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.Delete.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Delete.ForeColor = System.Drawing.Color.White;
            this.Delete.Location = new System.Drawing.Point(310, 515);
            this.Delete.Name = "Delete";
            this.Delete.Size = new System.Drawing.Size(62, 32);
            this.Delete.TabIndex = 8;
            this.Delete.Text = "Delete";
            this.Delete.UseVisualStyleBackColor = false;
            this.Delete.Click += new System.EventHandler(this.Delete_Click);
            // 
            // Move
            // 
            this.Move.BackColor = System.Drawing.Color.DodgerBlue;
            this.Move.FlatAppearance.BorderSize = 0;
            this.Move.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
            this.Move.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.Move.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.Move.ForeColor = System.Drawing.Color.White;
            this.Move.Location = new System.Drawing.Point(254, 515);
            this.Move.Name = "Move";
            this.Move.Size = new System.Drawing.Size(58, 32);
            this.Move.TabIndex = 7;
            this.Move.Text = "Move";
            this.Move.UseVisualStyleBackColor = false;
            this.Move.Click += new System.EventHandler(this.Move_Click);
            // 
            // InventoryManagment
            // 
            this.InventoryManagment.AutoSize = true;
            this.InventoryManagment.BackColor = System.Drawing.Color.Transparent;
            this.InventoryManagment.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.InventoryManagment.ForeColor = System.Drawing.Color.White;
            this.InventoryManagment.Location = new System.Drawing.Point(147, 82);
            this.InventoryManagment.Name = "InventoryManagment";
            this.InventoryManagment.Size = new System.Drawing.Size(424, 46);
            this.InventoryManagment.TabIndex = 6;
            this.InventoryManagment.Text = "Inventory Management";
            // 
            // drawerTable
            // 
            this.drawerTable.AutoSize = true;
            this.drawerTable.BackColor = System.Drawing.Color.Transparent;
            this.drawerTable.Location = new System.Drawing.Point(379, 252);
            this.drawerTable.Name = "drawerTable";
            this.drawerTable.Size = new System.Drawing.Size(751, 262);
            this.drawerTable.TabIndex = 5;
            this.drawerTable.drawerButton_Click += new System.EventHandler(this.drawerSelected);
            // 
            // SearchItemsButton
            // 
            this.SearchItemsButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.SearchItemsButton.Image = ((System.Drawing.Image)(resources.GetObject("SearchItemsButton.Image")));
            this.SearchItemsButton.Location = new System.Drawing.Point(350, 251);
            this.SearchItemsButton.Name = "SearchItemsButton";
            this.SearchItemsButton.Size = new System.Drawing.Size(23, 22);
            this.SearchItemsButton.TabIndex = 4;
            this.SearchItemsButton.UseVisualStyleBackColor = true;
            this.SearchItemsButton.Click += new System.EventHandler(this.SearchInventoryList_Event);
            // 
            // SearchBox
            // 
            this.SearchBox.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
            this.SearchBox.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
            this.SearchBox.Location = new System.Drawing.Point(151, 252);
            this.SearchBox.Name = "SearchBox";
            this.SearchBox.Size = new System.Drawing.Size(217, 20);
            this.SearchBox.TabIndex = 3;
            this.SearchBox.KeyDown += new System.Windows.Forms.KeyEventHandler(this.EnterKeyHandler);
            // 
            // InventoryListBox
            // 
            this.InventoryListBox.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
            this.InventoryListBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.InventoryListBox.FormattingEnabled = true;
            this.InventoryListBox.HorizontalScrollbar = true;
            this.InventoryListBox.ItemHeight = 25;
            this.InventoryListBox.Location = new System.Drawing.Point(151, 278);
            this.InventoryListBox.Name = "InventoryListBox";
            this.InventoryListBox.Size = new System.Drawing.Size(222, 229);
            this.InventoryListBox.Sorted = true;
            this.InventoryListBox.TabIndex = 1;
            this.InventoryListBox.SelectedIndexChanged += new System.EventHandler(this.InventoryListBox_SelectedIndexChanged);
            // 
            // AddItemPanel
            // 
            this.AddItemPanel.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
            this.AddItemPanel.Controls.Add(this.AddItemEntry);
            this.AddItemPanel.Controls.Add(this.AddItem);
            this.AddItemPanel.Controls.Add(this.AddItemLabel);
            this.AddItemPanel.Location = new System.Drawing.Point(379, 512);
            this.AddItemPanel.Name = "AddItemPanel";
            this.AddItemPanel.Size = new System.Drawing.Size(747, 34);
            this.AddItemPanel.TabIndex = 11;
            this.AddItemPanel.Visible = false;
            // 
            // AddItemEntry
            // 
            this.AddItemEntry.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
            this.AddItemEntry.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.CustomSource;
            this.AddItemEntry.ForeColor = System.Drawing.Color.Gray;
            this.AddItemEntry.Location = new System.Drawing.Point(504, 6);
            this.AddItemEntry.MaxLength = 50;
            this.AddItemEntry.Name = "AddItemEntry";
            this.AddItemEntry.Size = new System.Drawing.Size(130, 20);
            this.AddItemEntry.TabIndex = 1;
            this.AddItemEntry.Text = "Do not use abbreviations.";
            this.AddItemEntry.Enter += new System.EventHandler(this.AddEntryEntered);
            this.AddItemEntry.KeyDown += new System.Windows.Forms.KeyEventHandler(this.EnterKeyHandler);
            // 
            // AddItem
            // 
            this.AddItem.BackColor = System.Drawing.Color.WhiteSmoke;
            this.AddItem.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.AddItem.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.AddItem.ForeColor = System.Drawing.Color.White;
            this.AddItem.Location = new System.Drawing.Point(640, 5);
            this.AddItem.Name = "AddItem";
            this.AddItem.Size = new System.Drawing.Size(75, 23);
            this.AddItem.TabIndex = 10;
            this.AddItem.Text = "Add Item";
            this.AddItem.UseVisualStyleBackColor = false;
            this.AddItem.Click += new System.EventHandler(this.AddItem_Event);
            // 
            // AddItemLabel
            // 
            this.AddItemLabel.AutoSize = true;
            this.AddItemLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.AddItemLabel.Location = new System.Drawing.Point(383, 7);
            this.AddItemLabel.Name = "AddItemLabel";
            this.AddItemLabel.Size = new System.Drawing.Size(123, 16);
            this.AddItemLabel.TabIndex = 0;
            this.AddItemLabel.Text = "Enter item name:";
            // 
            // SelectDrawerLabel
            // 
            this.SelectDrawerLabel.BackColor = System.Drawing.Color.Transparent;
            this.SelectDrawerLabel.Font = new System.Drawing.Font("Calibri", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.SelectDrawerLabel.ForeColor = System.Drawing.Color.White;
            this.SelectDrawerLabel.Location = new System.Drawing.Point(379, 511);
            this.SelectDrawerLabel.Name = "SelectDrawerLabel";
            this.SelectDrawerLabel.Size = new System.Drawing.Size(460, 41);
            this.SelectDrawerLabel.TabIndex = 12;
            this.SelectDrawerLabel.Text = "Click a button to modify a drawer";
            // 
            // HardwareOptionsPanel
            // 
            this.HardwareOptionsPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.HardwareOptionsPanel.BackColor = System.Drawing.SystemColors.ControlLight;
            this.HardwareOptionsPanel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("HardwareOptionsPanel.BackgroundImage")));
            this.HardwareOptionsPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.HardwareOptionsPanel.Controls.Add(this.label2);
            this.HardwareOptionsPanel.Controls.Add(this.label1);
            this.HardwareOptionsPanel.Controls.Add(this.ThirteenSecondRadioButton);
            this.HardwareOptionsPanel.Controls.Add(this.TwentytwoSecondRadioButton);
            this.HardwareOptionsPanel.Controls.Add(this.columnLightSelector);
            this.HardwareOptionsPanel.Controls.Add(this.SixteenSecondsRadioButton);
            this.HardwareOptionsPanel.Controls.Add(this.SystemMaintanence);
            this.HardwareOptionsPanel.Controls.Add(this.NineteenSecondRadioButton);
            this.HardwareOptionsPanel.Location = new System.Drawing.Point(0, 0);
            this.HardwareOptionsPanel.Name = "HardwareOptionsPanel";
            this.HardwareOptionsPanel.Size = new System.Drawing.Size(1280, 719);
            this.HardwareOptionsPanel.TabIndex = 2;
            // 
            // label2
            // 
            this.label2.BackColor = System.Drawing.Color.SlateGray;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.White;
            this.label2.Location = new System.Drawing.Point(151, 396);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(979, 39);
            this.label2.TabIndex = 33;
            this.label2.Text = "Change Indication Time";
            // 
            // label1
            // 
            this.label1.BackColor = System.Drawing.Color.SlateGray;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.White;
            this.label1.Location = new System.Drawing.Point(151, 198);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(979, 39);
            this.label1.TabIndex = 32;
            this.label1.Text = "Test LEDs";
            // 
            // ThirteenSecondRadioButton
            // 
            this.ThirteenSecondRadioButton.AutoSize = true;
            this.ThirteenSecondRadioButton.BackColor = System.Drawing.Color.Transparent;
            this.ThirteenSecondRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.ThirteenSecondRadioButton.ForeColor = System.Drawing.Color.White;
            this.ThirteenSecondRadioButton.Location = new System.Drawing.Point(172, 450);
            this.ThirteenSecondRadioButton.Name = "ThirteenSecondRadioButton";
            this.ThirteenSecondRadioButton.Size = new System.Drawing.Size(119, 24);
            this.ThirteenSecondRadioButton.TabIndex = 28;
            this.ThirteenSecondRadioButton.Tag = "5";
            this.ThirteenSecondRadioButton.Text = "13 seconds";
            this.ThirteenSecondRadioButton.UseVisualStyleBackColor = false;
            // 
            // TwentytwoSecondRadioButton
            // 
            this.TwentytwoSecondRadioButton.AutoSize = true;
            this.TwentytwoSecondRadioButton.BackColor = System.Drawing.Color.Transparent;
            this.TwentytwoSecondRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.TwentytwoSecondRadioButton.ForeColor = System.Drawing.Color.White;
            this.TwentytwoSecondRadioButton.Location = new System.Drawing.Point(950, 450);
            this.TwentytwoSecondRadioButton.Name = "TwentytwoSecondRadioButton";
            this.TwentytwoSecondRadioButton.Size = new System.Drawing.Size(119, 24);
            this.TwentytwoSecondRadioButton.TabIndex = 31;
            this.TwentytwoSecondRadioButton.Tag = "8";
            this.TwentytwoSecondRadioButton.Text = "22 seconds";
            this.TwentytwoSecondRadioButton.UseVisualStyleBackColor = false;
            // 
            // columnLightSelector
            // 
            this.columnLightSelector.BackColor = System.Drawing.Color.Transparent;
            this.columnLightSelector.Location = new System.Drawing.Point(169, 250);
            this.columnLightSelector.Name = "columnLightSelector";
            this.columnLightSelector.Size = new System.Drawing.Size(936, 134);
            this.columnLightSelector.TabIndex = 25;
            this.columnLightSelector.columnButton_onClick += new System.EventHandler(this.columnsLEDSelected);
            // 
            // SixteenSecondsRadioButton
            // 
            this.SixteenSecondsRadioButton.AutoSize = true;
            this.SixteenSecondsRadioButton.BackColor = System.Drawing.Color.Transparent;
            this.SixteenSecondsRadioButton.Checked = true;
            this.SixteenSecondsRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.SixteenSecondsRadioButton.ForeColor = System.Drawing.Color.White;
            this.SixteenSecondsRadioButton.Location = new System.Drawing.Point(417, 450);
            this.SixteenSecondsRadioButton.Name = "SixteenSecondsRadioButton";
            this.SixteenSecondsRadioButton.Size = new System.Drawing.Size(119, 24);
            this.SixteenSecondsRadioButton.TabIndex = 29;
            this.SixteenSecondsRadioButton.TabStop = true;
            this.SixteenSecondsRadioButton.Tag = "6";
            this.SixteenSecondsRadioButton.Text = "16 seconds";
            this.SixteenSecondsRadioButton.UseVisualStyleBackColor = false;
            // 
            // SystemMaintanence
            // 
            this.SystemMaintanence.AutoSize = true;
            this.SystemMaintanence.BackColor = System.Drawing.Color.Transparent;
            this.SystemMaintanence.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.SystemMaintanence.ForeColor = System.Drawing.Color.White;
            this.SystemMaintanence.Location = new System.Drawing.Point(148, 85);
            this.SystemMaintanence.Name = "SystemMaintanence";
            this.SystemMaintanence.Size = new System.Drawing.Size(392, 46);
            this.SystemMaintanence.TabIndex = 4;
            this.SystemMaintanence.Text = "System Maintanence";
            // 
            // NineteenSecondRadioButton
            // 
            this.NineteenSecondRadioButton.AutoSize = true;
            this.NineteenSecondRadioButton.BackColor = System.Drawing.Color.Transparent;
            this.NineteenSecondRadioButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.NineteenSecondRadioButton.ForeColor = System.Drawing.Color.White;
            this.NineteenSecondRadioButton.Location = new System.Drawing.Point(684, 450);
            this.NineteenSecondRadioButton.Name = "NineteenSecondRadioButton";
            this.NineteenSecondRadioButton.Size = new System.Drawing.Size(119, 24);
            this.NineteenSecondRadioButton.TabIndex = 30;
            this.NineteenSecondRadioButton.Tag = "7";
            this.NineteenSecondRadioButton.Text = "19 seconds";
            this.NineteenSecondRadioButton.UseVisualStyleBackColor = false;
            // 
            // ViewControlPanel
            // 
            this.ViewControlPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) 
            | System.Windows.Forms.AnchorStyles.Right)));
            this.ViewControlPanel.BackColor = System.Drawing.SystemColors.InactiveCaptionText;
            this.ViewControlPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.ViewControlPanel.Controls.Add(this.ToReportViewButton);
            this.ViewControlPanel.Controls.Add(this.ToHardwareViewButton);
            this.ViewControlPanel.Controls.Add(this.ToInventoryViewButton);
            this.ViewControlPanel.Controls.Add(this.ToMicrophoneViewButton);
            this.ViewControlPanel.Location = new System.Drawing.Point(0, 675);
            this.ViewControlPanel.Name = "ViewControlPanel";
            this.ViewControlPanel.Size = new System.Drawing.Size(1280, 106);
            this.ViewControlPanel.TabIndex = 3;
            // 
            // ToReportViewButton
            // 
            this.ToReportViewButton.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            this.ToReportViewButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            this.ToReportViewButton.Image = global::Supply_Fetch.Properties.Resources.report_icon4;
            this.ToReportViewButton.Location = new System.Drawing.Point(862, 21);
            this.ToReportViewButton.Name = "ToReportViewButton";
            this.ToReportViewButton.Size = new System.Drawing.Size(70, 70);
            this.ToReportViewButton.TabIndex = 6;
            this.ButtonTip.SetToolTip(this.ToReportViewButton, "Inventory Report");
            this.ToReportViewButton.UseVisualStyleBackColor = false;
            this.ToReportViewButton.Click += new System.EventHandler(this.ToReportViewButton_Click);
            // 
            // ToHardwareViewButton
            // 
            this.ToHardwareViewButton.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            this.ToHardwareViewButton.Image = ((System.Drawing.Image)(resources.GetObject("ToHardwareViewButton.Image")));
            this.ToHardwareViewButton.Location = new System.Drawing.Point(731, 21);
            this.ToHardwareViewButton.Name = "ToHardwareViewButton";
            this.ToHardwareViewButton.Size = new System.Drawing.Size(70, 70);
            this.ToHardwareViewButton.TabIndex = 5;
            this.ButtonTip.SetToolTip(this.ToHardwareViewButton, "System Options");
            this.ToHardwareViewButton.UseVisualStyleBackColor = false;
            this.ToHardwareViewButton.Click += new System.EventHandler(this.ToHardwareViewButton_Click);
            // 
            // ToInventoryViewButton
            // 
            this.ToInventoryViewButton.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            this.ToInventoryViewButton.Image = ((System.Drawing.Image)(resources.GetObject("ToInventoryViewButton.Image")));
            this.ToInventoryViewButton.Location = new System.Drawing.Point(599, 21);
            this.ToInventoryViewButton.Name = "ToInventoryViewButton";
            this.ToInventoryViewButton.Size = new System.Drawing.Size(70, 70);
            this.ToInventoryViewButton.TabIndex = 4;
            this.ButtonTip.SetToolTip(this.ToInventoryViewButton, "Supply Room Inventory");
            this.ToInventoryViewButton.UseVisualStyleBackColor = false;
            this.ToInventoryViewButton.Click += new System.EventHandler(this.ToInventoryViewButton_Click);
            // 
            // ToMicrophoneViewButton
            // 
            this.ToMicrophoneViewButton.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            this.ToMicrophoneViewButton.Image = ((System.Drawing.Image)(resources.GetObject("ToMicrophoneViewButton.Image")));
            this.ToMicrophoneViewButton.Location = new System.Drawing.Point(461, 21);
            this.ToMicrophoneViewButton.Name = "ToMicrophoneViewButton";
            this.ToMicrophoneViewButton.Size = new System.Drawing.Size(70, 70);
            this.ToMicrophoneViewButton.TabIndex = 3;
            this.ButtonTip.SetToolTip(this.ToMicrophoneViewButton, "Speech Recognition");
            this.ToMicrophoneViewButton.UseVisualStyleBackColor = false;
            this.ToMicrophoneViewButton.Click += new System.EventHandler(this.ToMicrophoneViewButton_Click);
            // 
            // ledIndicationWorker
            // 
            this.ledIndicationWorker.WorkerReportsProgress = true;
            // 
            // speechRecognitionWorker
            // 
            this.speechRecognitionWorker.WorkerReportsProgress = true;
            this.speechRecognitionWorker.WorkerSupportsCancellation = true;
            // 
            // contextMenuStrip1
            // 
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new System.Drawing.Size(61, 4);
            // 
            // ReportViewPanel
            // 
            this.ReportViewPanel.Anchor = System.Windows.Forms.AnchorStyles.None;
            this.ReportViewPanel.BackColor = System.Drawing.Color.Transparent;
            this.ReportViewPanel.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("ReportViewPanel.BackgroundImage")));
            this.ReportViewPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.ReportViewPanel.Controls.Add(this.crystalReportViewer2);
            this.ReportViewPanel.Controls.Add(this.RefreshReportLabel);
            this.ReportViewPanel.Controls.Add(this.ReportLabel);
            this.ReportViewPanel.Controls.Add(this.shapeContainer1);
            this.ReportViewPanel.Location = new System.Drawing.Point(0, 0);
            this.ReportViewPanel.Name = "ReportViewPanel";
            this.ReportViewPanel.Size = new System.Drawing.Size(1280, 720);
            this.ReportViewPanel.TabIndex = 12;
            // 
            // crystalReportViewer2
            // 
            this.crystalReportViewer2.ActiveViewIndex = -1;
            this.crystalReportViewer2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.crystalReportViewer2.Cursor = System.Windows.Forms.Cursors.Default;
            this.crystalReportViewer2.Location = new System.Drawing.Point(151, 200);
            this.crystalReportViewer2.Name = "crystalReportViewer2";
            this.crystalReportViewer2.Size = new System.Drawing.Size(979, 412);
            this.crystalReportViewer2.TabIndex = 6;
            // 
            // RefreshReportLabel
            // 
            this.RefreshReportLabel.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.RefreshReportLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.RefreshReportLabel.ForeColor = System.Drawing.Color.White;
            this.RefreshReportLabel.Location = new System.Drawing.Point(155, 147);
            this.RefreshReportLabel.Name = "RefreshReportLabel";
            this.RefreshReportLabel.Size = new System.Drawing.Size(87, 34);
            this.RefreshReportLabel.TabIndex = 5;
            this.RefreshReportLabel.Text = "Refresh Report";
            this.RefreshReportLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            // 
            // ReportLabel
            // 
            this.ReportLabel.AutoSize = true;
            this.ReportLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 30F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.ReportLabel.ForeColor = System.Drawing.Color.White;
            this.ReportLabel.Location = new System.Drawing.Point(149, 83);
            this.ReportLabel.Name = "ReportLabel";
            this.ReportLabel.Size = new System.Drawing.Size(313, 46);
            this.ReportLabel.TabIndex = 0;
            this.ReportLabel.Text = "Inventory Report";
            // 
            // shapeContainer1
            // 
            this.shapeContainer1.Location = new System.Drawing.Point(0, 0);
            this.shapeContainer1.Margin = new System.Windows.Forms.Padding(0);
            this.shapeContainer1.Name = "shapeContainer1";
            this.shapeContainer1.Shapes.AddRange(new Microsoft.VisualBasic.PowerPacks.Shape[] {
            this.lineShape11,
            this.lineShape10,
            this.lineShape9,
            this.lineShape8,
            this.lineShape7,
            this.lineShape6,
            this.lineShape5,
            this.lineShape4,
            this.lineShape3,
            this.lineShape2,
            this.lineShape1});
            this.shapeContainer1.Size = new System.Drawing.Size(1280, 720);
            this.shapeContainer1.TabIndex = 4;
            this.shapeContainer1.TabStop = false;
            // 
            // lineShape11
            // 
            this.lineShape11.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape11.Name = "lineShape11";
            this.lineShape11.X1 = 207;
            this.lineShape11.X2 = 224;
            this.lineShape11.Y1 = 185;
            this.lineShape11.Y2 = 203;
            // 
            // lineShape10
            // 
            this.lineShape10.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape10.BorderWidth = 2;
            this.lineShape10.Name = "lineShape10";
            this.lineShape10.X1 = 198;
            this.lineShape10.X2 = 213;
            this.lineShape10.Y1 = 173;
            this.lineShape10.Y2 = 187;
            // 
            // lineShape9
            // 
            this.lineShape9.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape9.Name = "lineShape9";
            this.lineShape9.X1 = 199;
            this.lineShape9.X2 = 219;
            this.lineShape9.Y1 = 168;
            this.lineShape9.Y2 = 196;
            // 
            // lineShape8
            // 
            this.lineShape8.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape8.BorderWidth = 2;
            this.lineShape8.Name = "lineShape8";
            this.lineShape8.X1 = 206;
            this.lineShape8.X2 = 216;
            this.lineShape8.Y1 = 173;
            this.lineShape8.Y2 = 191;
            // 
            // lineShape7
            // 
            this.lineShape7.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape7.BorderWidth = 3;
            this.lineShape7.Name = "lineShape7";
            this.lineShape7.X1 = 184;
            this.lineShape7.X2 = 211;
            this.lineShape7.Y1 = 171;
            this.lineShape7.Y2 = 187;
            // 
            // lineShape6
            // 
            this.lineShape6.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape6.BorderWidth = 2;
            this.lineShape6.Name = "lineShape6";
            this.lineShape6.X1 = 202;
            this.lineShape6.X2 = 220;
            this.lineShape6.Y1 = 172;
            this.lineShape6.Y2 = 197;
            // 
            // lineShape5
            // 
            this.lineShape5.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape5.BorderWidth = 2;
            this.lineShape5.Name = "lineShape5";
            this.lineShape5.X1 = 192;
            this.lineShape5.X2 = 221;
            this.lineShape5.Y1 = 180;
            this.lineShape5.Y2 = 198;
            // 
            // lineShape4
            // 
            this.lineShape4.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape4.BorderWidth = 2;
            this.lineShape4.Name = "lineShape4";
            this.lineShape4.X1 = 188;
            this.lineShape4.X2 = 215;
            this.lineShape4.Y1 = 176;
            this.lineShape4.Y2 = 192;
            // 
            // lineShape3
            // 
            this.lineShape3.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape3.BorderWidth = 4;
            this.lineShape3.Name = "lineShape3";
            this.lineShape3.X1 = 196;
            this.lineShape3.X2 = 217;
            this.lineShape3.Y1 = 174;
            this.lineShape3.Y2 = 192;
            // 
            // lineShape2
            // 
            this.lineShape2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape2.BorderWidth = 2;
            this.lineShape2.Name = "lineShape2";
            this.lineShape2.X1 = 209;
            this.lineShape2.X2 = 220;
            this.lineShape2.Y1 = 176;
            this.lineShape2.Y2 = 196;
            // 
            // lineShape1
            // 
            this.lineShape1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(0)))));
            this.lineShape1.Name = "lineShape1";
            this.lineShape1.X1 = 199;
            this.lineShape1.X2 = 216;
            this.lineShape1.Y1 = 176;
            this.lineShape1.Y2 = 196;
            // 
            // ButtonTip
            // 
            this.ButtonTip.AutomaticDelay = 600;
            // 
            // GUI
            // 
            this.BackColor = System.Drawing.SystemColors.ControlDarkDark;
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.ClientSize = new System.Drawing.Size(1280, 780);
            this.Controls.Add(this.PresentFeedback);
            this.Controls.Add(this.ViewControlPanel);
            this.Controls.Add(this.GUIControlPanel);
            this.Controls.Add(this.ReportViewPanel);
            this.Controls.Add(this.InventoryOptionsPanel);
            this.Controls.Add(this.MainPanel);
            this.Controls.Add(this.HardwareOptionsPanel);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "GUI";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
            this.MainPanel.ResumeLayout(false);
            this.MainPanel.PerformLayout();
            this.ActivateSpeechPanel.ResumeLayout(false);
            this.SpeakNowPanel.ResumeLayout(false);
            this.NoMatchFoundPanel.ResumeLayout(false);
            this.IndicationProcessPanel.ResumeLayout(false);
            this.GUIControlPanel.ResumeLayout(false);
            this.InventoryOptionsPanel.ResumeLayout(false);
            this.InventoryOptionsPanel.PerformLayout();
            this.AddItemPanel.ResumeLayout(false);
            this.AddItemPanel.PerformLayout();
            this.HardwareOptionsPanel.ResumeLayout(false);
            this.HardwareOptionsPanel.PerformLayout();
            this.ViewControlPanel.ResumeLayout(false);
            this.ReportViewPanel.ResumeLayout(false);
            this.ReportViewPanel.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        private void AddEntryEntered(object sender, EventArgs e)
        {
            this.AddItemEntry.Text = "";
            this.AddItemEntry.ForeColor = Color.Black;
        }

        //This is used to check if the enter key, was really pressed.
        [System.Runtime.InteropServices.DllImport("user32.dll")]
        private static extern short GetKeyState(Keys key);

        private void EnterKeyHandler(object sender, KeyEventArgs e)
        {
            if ( (e.KeyCode == Keys.Enter ) && (GetKeyState(Keys.Enter) < 0) )
            {
                if (sender == this.AddItemEntry)
                {
                    this.AddItem_Event(sender, e);
                }
                else if (sender == this.SearchBox)
                {
                    this.SearchInventoryList_Event(sender, e);
                }
                else if (sender == this.NoMatchesCombobox)
                {
                    this.NoMatchesCombobox_ItemSelected(sender, e);
                }
                else
                    /*ignore*/;
            }
        }

        private void ToInventoryViewButton_Click(object sender, EventArgs e)
        {
            this.MainPanel.Hide();
            this.HardwareOptionsPanel.Hide();
            this.ReportViewPanel.Hide();
            this.InventoryOptionsPanel.Show();

            this.ToInventoryViewButton.Enabled = false;
            this.ToMicrophoneViewButton.Enabled = true;
            this.ToHardwareViewButton.Enabled = true;
            this.ToReportViewButton.Enabled = true;
        }

        private void ToHardwareViewButton_Click(object sender, EventArgs e)
        {
            this.MainPanel.Hide();
            this.HardwareOptionsPanel.Show();
            this.ReportViewPanel.Hide();
            this.InventoryOptionsPanel.Hide();

            this.ToInventoryViewButton.Enabled = true;
            this.ToMicrophoneViewButton.Enabled = true;
            this.ToHardwareViewButton.Enabled = false;
            this.ToReportViewButton.Enabled = true;
        }

        private void ToMicrophoneViewButton_Click(object sender, EventArgs e)
        {
            this.MainPanel.Show();
            this.HardwareOptionsPanel.Hide();
            this.ReportViewPanel.Hide();
            this.InventoryOptionsPanel.Hide();

            this.ToInventoryViewButton.Enabled = true;
            this.ToMicrophoneViewButton.Enabled = false;
            this.ToHardwareViewButton.Enabled = true;
            this.ToReportViewButton.Enabled = true;
        }

        private void ToReportViewButton_Click(object sender, EventArgs e)
        {
            this.MainPanel.Hide();
            this.HardwareOptionsPanel.Hide();
            this.ReportViewPanel.Show();
            this.InventoryOptionsPanel.Hide();

            this.ToInventoryViewButton.Enabled = true;
            this.ToMicrophoneViewButton.Enabled = true;
            this.ToHardwareViewButton.Enabled = true;
            this.ToReportViewButton.Enabled = false;

            presentRefresh();
            presentFeedback("Update report by clicking the \"refresh\" button");
        }


        public void presentFeedback(string message)
        {
            if ( (message != null) && (message != "") )
            {
                Thread t = new Thread(new ThreadStart(() =>
                {
                    var d = new setFeedbackTextDelegate(setFeedbackText);
                    PresentFeedback.Invoke(d, new object[] { message });  //.Text = message;

                    WaitTime.millisecs(FeedbackTime);
                    PresentFeedback.Invoke(d, new object[] { "" });
                })); t.IsBackground = true; t.Start();
            }
        }

        private delegate void setFeedbackTextDelegate(string text);

        private void setFeedbackText(string text)
        {
            this.PresentFeedback.Text = text;
        }

        public void presentRefresh()
        {
            Thread t = new Thread(new ThreadStart(() =>
            {
                var d = new setRefreshDelegate(setRefreshMessage);

                RefreshReportLabel.Invoke(d, true);  //.Text = message;
                WaitTime.millisecs(FeedbackTime);
                RefreshReportLabel.Invoke(d, false);
            })); t.IsBackground = true; t.Start();
        }

        private delegate void setRefreshDelegate(bool enable);

        private void setRefreshMessage(bool enable)
        {
            if (enable)
            {
                this.RefreshReportLabel.Show();
                this.lineShape1.Show();
                this.lineShape2.Show();
                this.lineShape3.Show();
                this.lineShape4.Show();
                this.lineShape5.Show();
                this.lineShape6.Show();
                this.lineShape7.Show();
                this.lineShape8.Show();
                this.lineShape9.Show();
                this.lineShape10.Show();
                this.lineShape11.Show();
            }
            else
            {
                this.RefreshReportLabel.Hide();
                this.lineShape1.Hide();
                this.lineShape2.Hide();
                this.lineShape3.Hide();
                this.lineShape4.Hide();
                this.lineShape5.Hide();
                this.lineShape6.Hide();
                this.lineShape7.Hide();
                this.lineShape8.Hide();
                this.lineShape9.Hide();
                this.lineShape10.Hide();
                this.lineShape11.Hide();
            }
            //this.PresentFeedback.Text = text;
        }

        public void Wait(int t)
        {
            //Start Delay
            DateTime timeAtStart = DateTime.Now;
            int maxWaitTime = t;
            while (true)
            {
                if ((DateTime.Now - timeAtStart).TotalMilliseconds >= maxWaitTime)
                {
                    break;
                }
            }
        }

        public void ResetProgressBar(int max)
        {
            this.IndicationProgressBar.Minimum = 0;
            this.IndicationProgressBar.Maximum = max;
            this.IndicationProgressBar.Value = 0;
            this.IndicationProgressBar.Step = 1;
        }

        public void StepProgressBar()
        {
            this.IndicationProgressBar.PerformStep();
        }

        private void drawerSelected(object sender, EventArgs e)
        {
            if (drawers != null)
            {
                if (this.drawerTable.SecondSelectedDrawer == null)
                {
                    for (int i = 0; i < drawers.Count(); i++)
                    {
                        if ((drawers[i].GetRow().ToString() + "," + drawers[i].GetColumn().ToString()) == ((Button)sender).Name)
                        {
                            this.InventoryListBox.Items.Clear();

                            if (drawers[i].GetItems() == null)
                            {
                                this.InventoryListBox.Items.Clear();
                            }
                            else
                            {
                                foreach (Item item in drawers[i].GetItems())
                                {
                                    this.InventoryListBox.Items.Add(item.GetName());
                                }
                            }
                        }
                    }

                    this.Delete.Enabled = true;
                    this.Move.Enabled = true;
                    this.AddItemPanel.Visible = true;
                }
                else
                {
                    if (this.currentSelectedItem != null)
                    {
                        this.presentFeedback(this.currentSelectedItem + " is being moved to location " + this.drawerTable.SecondSelectedDrawer.Text);
                        string[] fromLocation = this.drawerTable.SelectedDrawer.Name.Split(',');
                        string[] toLocation = this.drawerTable.SecondSelectedDrawer.Name.Split(',');

                        this.guiEventSubscription(new MoveAction(this.currentSelectedItem, fromLocation, toLocation));

                        this.drawerTable.changeSelectionMode();
                        this.drawerTable.ColorDrawers();
                        this.drawerTable.HighlightSelectedDrawers();
                    }
                }
            }
            else
            {
                this.InventoryListBox.Items.Clear();
            }
        }

        private void columnsLEDSelected(object sender, EventArgs e)
        {
            if (((Button)sender).Name == "turnAllOn")
            {
                this.guiEventSubscription(new HardwareAction(Constants.LEDActionCodes.TURN_ALL_ON));
            }
            else if (((Button)sender).Name == "turnAllOff")
            {
                this.guiEventSubscription(new HardwareAction(Constants.LEDActionCodes.TURN_ALL_OFF));
            }
            else
            {
                int led = Int32.Parse(((Button)sender).Name);

                if (this.LEDlist.GetLED(led).State == Constants.OFF)
                {
                    //Change image color.
                    this.LEDlist.GetLED(led).State = Constants.ON;
                }
                else
                {
                    //Change image color.
                    this.LEDlist.GetLED(led).State = Constants.OFF;
                }

                this.guiEventSubscription(new HardwareAction(this.LEDlist.GetLED(led)));

            }
        }

        public void UpdateItemMap(string[] itemNames, string[][] itemLocations, Drawer[] drawers)
        {
            this.itemNames = itemNames;
            this.itemLocations = itemLocations;
            this.drawers = drawers;
            this.InventoryListBox.Items.Clear();

            this.SearchBox.AutoCompleteCustomSource.Clear();
            this.SearchBox.AutoCompleteCustomSource.AddRange(itemNames);

            this.AddItemEntry.AutoCompleteCustomSource.Clear();
            this.AddItemEntry.AutoCompleteCustomSource.AddRange(itemNames);

            this.NoMatchesCombobox.Items.Clear();
            this.NoMatchesCombobox.Items.AddRange(itemNames);

            if (this.drawerTable.SelectedDrawer != null)
            {
                for (int i = 0; i < this.drawers.Count(); i++)
                {
                    if ((drawers[i].GetRow().ToString() + "," + drawers[i].GetColumn().ToString()) == this.drawerTable.SelectedDrawer.Name)
                    {
                        foreach (Item item in drawers[i].GetItems())
                        {
                            this.InventoryListBox.Items.Add(item.GetName());
                        }
                    }
                }
            }
            else
            {
                this.InventoryListBox.Items.AddRange(this.itemNames);
            }
        }

        private void InventoryListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.currentSelectedItem = this.InventoryListBox.SelectedItem.ToString();

            int itemIndex = this.itemLocations.Length;

            for (int i = 0; i < this.itemNames.Length; i++)
            {
                if (this.itemNames[i] == this.currentSelectedItem)
                {
                    itemIndex = i;
                    break;
                }
            }

            if (itemIndex < this.itemLocations.Length)
            {
                this.drawerTable.ColorDrawers();
                this.drawerTable.HighlightDrawers(this.itemLocations[itemIndex]);
            }
        }

        private void ListAllItems_Click(object sender, EventArgs e)
        {
            this.drawerTable.DeSelectDrawers();
            this.drawerTable.ColorDrawers();
            this.Delete.Enabled = false;
            this.Move.Enabled = false;
            this.AddItemPanel.Visible = false;
            this.InventoryListBox.Items.Clear();
            this.InventoryListBox.Items.AddRange(this.itemNames);
            this.currentSelectedItem = null;
        }

        private void Move_Click(object sender, EventArgs e)
        {
            if (this.drawerTable.SelectedDrawer != null)
            {
                if (this.drawerTable.SecondSelectedDrawer != null)
                {
                    if(this.InventoryListBox.SelectedItem != null)
                    {
                        this.presentFeedback("Please select item from list first");
                    }
                }
                else
                {
                    if (this.InventoryListBox.SelectedItem != null)
                    {
                        this.drawerTable.changeSelectionMode();
                        this.presentFeedback("Please select another drawer now");
                    }
                    else
                    {
                        this.presentFeedback("Please select item from the list first");
                    }
                }
            }
            else
            {
                this.presentFeedback("Please select a drawer first");
            }
        }

        private void Delete_Click(object sender, EventArgs e)
        {
            if (this.drawerTable.SelectedDrawer == null)
            {
                MessageBox.Show("Please a drawer to remove item from the diagram first.", "Please Select Drawer", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if ((this.InventoryListBox.SelectedItem == null) || (this.InventoryListBox.SelectedItem == ""))
                {
                    MessageBox.Show("Please select item from list before selecting delete.", "Please Select Item First", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string[] separators = new string[] { "," };
                    string tempItemName = InventoryListBox.SelectedItem.ToString();
                    string[] tempLocation = drawerTable.SelectedDrawer.Name.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    int tempRow = Int32.Parse(tempLocation[0]);
                    int tempCol = Int32.Parse(tempLocation[1]);

                    this.guiEventSubscription(new RemoveAction(tempItemName, tempRow, tempCol));

                    this.drawerTable.ColorDrawers();
                    this.drawerTable.HighlightSelectedDrawers();
                }
            }
        }

        private void AddItem_Event(object sender, EventArgs e)
        {
            if (this.drawerTable.SelectedDrawer == null)
            {
                MessageBox.Show("Please select a drawer from the inventory map first.", "Please Select Drawer", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                if ((AddItemEntry.Text == null) || (AddItemEntry.Text == "") || (AddItemEntry.Text == "Do not use abbreviations."))
                {
                    MessageBox.Show("Please enter a name for the item first before selecting add item.", "Enter Name of Item", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string[] separators = new string[] { "," };
                    string[] tempLocation = drawerTable.SelectedDrawer.Name.Split(separators, StringSplitOptions.RemoveEmptyEntries);
                    int tempRow = Int32.Parse(tempLocation[0]);
                    int tempCol = Int32.Parse(tempLocation[1]);
                    string addItemName = AddItemEntry.Text;

                    this.AddItemEntry.Clear();
                    this.AddItemEntry.Text = "Do not use abbreviations.";
                    this.AddItemEntry.ForeColor = Color.Gray;

                    this.drawerTable.ColorDrawers();
                    this.drawerTable.HighlightSelectedDrawers();

                    this.guiEventSubscription(new AddAction(addItemName.ToLower(), tempRow, tempCol));
                }
            }
        }

        private void SearchInventoryList_Event(object sender, EventArgs e)
        {
            List<string> matches = new List<string>();

            foreach (string itemName in this.itemNames)
            {
                if (itemName.Contains(this.SearchBox.Text))
                {
                    matches.Add(itemName);
                }
            }

            this.SearchBox.Text = "";
            this.InventoryListBox.Items.Clear();
            this.InventoryListBox.Items.AddRange(matches.ToArray());

            this.drawerTable.DeSelectDrawers();
            this.drawerTable.ColorDrawers();
        }

        private void ActivatListenButton1_Click(object sender, EventArgs e)
        {
            if (!this.speechRecognitionWorker.IsBusy)
            {
                this.guiEventSubscription(new ActivateMicAction());
                this.columnLightSelector.DisableButtons();
                this.SpeakNowPanel.Show();
                this.NoMatchFoundPanel.Hide();
                this.ActivateSpeechPanel.Hide();
                this.IndicationProcessPanel.Hide();
            }

        }

        private void CancelRecognitionButton1_Click(object sender, EventArgs e)
        {
            this.guiEventSubscription(new DeactivateMicAction());
            this.columnLightSelector.EnableButtons();
            this.ActivateSpeechPanel.Show();
            this.SpeakNowPanel.Hide();
            this.NoMatchFoundPanel.Hide();
            this.IndicationProcessPanel.Hide();
        }

        private void CancelRecognitionButton2_Click(object sender, EventArgs e)
        {
            this.columnLightSelector.EnableButtons();
            this.ActivateSpeechPanel.Show();
            this.SpeakNowPanel.Hide();
            this.NoMatchFoundPanel.Hide();
            this.IndicationProcessPanel.Hide();
        }

        public void WordNotRecognized_Panel()
        {
            this.columnLightSelector.EnableButtons();
            this.NoMatchFoundPanel.Show();
            this.ActivateSpeechPanel.Hide();
            this.SpeakNowPanel.Hide();
            this.IndicationProcessPanel.Hide();
        }

        public void SpeechActivation_Panel()
        {
            this.columnLightSelector.EnableButtons();
            this.ActivateSpeechPanel.Show();
            this.NoMatchFoundPanel.Hide();
            this.SpeakNowPanel.Hide();
            this.IndicationProcessPanel.Hide();
        }

        public void IndicationProcess_Panel()
        {
            this.columnLightSelector.DisableButtons();
            this.IndicationProcessPanel.Show();
            this.NoMatchFoundPanel.Hide();
            this.ActivateSpeechPanel.Hide();
            this.SpeakNowPanel.Hide();
        }

        private void SpeakAgainButton_Click(object sender, EventArgs e)
        {
            this.guiEventSubscription(new ActivateMicAction());
            this.columnLightSelector.DisableButtons();
            this.SpeakNowPanel.Show();
            this.NoMatchFoundPanel.Hide();
            this.ActivateSpeechPanel.Hide();
            this.IndicationProcessPanel.Hide();
        }

        private void close_Click(object sender, EventArgs e)
        {

            this.guiEventSubscription(new CloseAction());

            this.Close();
        }

        private void NoMatchesCombobox_Entered(object sender, EventArgs e)
        {
            this.NoMatchesCombobox.Text = null;
            this.NoMatchesCombobox.Font = new Font(this.NoMatchesCombobox.Font.FontFamily, this.NoMatchesCombobox.Font.Size, FontStyle.Regular);
            this.NoMatchesCombobox.ForeColor = Color.Black;
        }

        private void NoMatchesCombobox_ItemSelected(object sender, EventArgs e)
        {
            if (this.NoMatchesCombobox.SelectedItem != null)
            {
                this.guiEventSubscription(new FindAction(this.NoMatchesCombobox.SelectedItem.ToString()));
            }
            else
            {
                this.presentFeedback("Please select item from list first");
            }

            this.NoMatchesCombobox.Text = "Select an item from the list...";
            this.NoMatchesCombobox.Font = new Font(this.NoMatchesCombobox.Font.FontFamily, this.NoMatchesCombobox.Font.Size, FontStyle.Italic);
            this.NoMatchesCombobox.ForeColor = Color.Gray;
            this.NoMatchesCombobox.Enabled = false;
            this.NoMatchesCombobox.Enabled = true;
        }

        public string[] ItemNames
        {
            get { return this.itemNames; }
        }

        private void minimizeGUI_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

    }

    #region Action Classes here.
    /// <summary>
    /// Class FindAction contains the information necessary for finding an item in the system.
    /// </summary>
    public class FindAction
    {

        private Item fItem;

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="fItem">The item to be looked for by the system.</param>
        public FindAction(string item)
        {
            this.fItem = new Item(item);
        }

        /// <summary>
        /// Returns the item being looked for by the system.
        /// </summary>
        public Item FItem
        {
            get { return this.fItem; }
        }

    }

    /// <summary>
    /// Class RemoveAction contains the information necessary for removing an item in the system.
    /// </summary>
    public class RemoveAction
    {

        private Item rItem;
        private Drawer location;

        /// <summary>
        /// Contructor.
        /// </summary>
        /// <param name="item">Item to be removed from the system.</param>
        /// <param name="loc">Location of item that is to be removed from the system.</param>
        public RemoveAction(string item, int dRow, int dCol)
        {
            this.rItem = new Item(item);
            this.location = new Drawer(dRow, dCol);
        }

        /// <summary>
        /// Returns the item to be removed from the system.
        /// </summary>
        public Item RItem
        {
            get { return this.rItem; }
        }

        /// <summary>
        /// Returns the location of the item to be removed from the system.
        /// </summary>
        public Drawer Location
        {
            get { return this.location; }
        }

    }

    /// <summary>
    /// Class AddAction contains the information necessary for adding an item in the system.
    /// Note: Might need to update later to allow for multiple locations to be added at same time.
    /// </summary>
    public class AddAction
    {

        private Item item;
        private Drawer location;

        /// <summary>
        /// Constructor sets up AddAction information.
        /// </summary>
        /// <param name="item">contains the items name.</param>
        /// <param name="loc">contains the location the item is to be added to.</param>
        public AddAction(string aItem, int dRow, int dCol)
        {
            this.item = new Item(aItem);
            this.location = new Drawer(dRow, dCol);
        }

        /// <summary>
        /// Returns the name of the item to be added to the system.
        /// </summary>
        public Item Item
        {
            get { return this.item; }
        }

        /// <summary>
        /// Returns the location of the item to be added to the system.
        /// </summary>
        public Drawer Location
        {
            get { return this.location; }
        }

    }
    
    /// <summary>
    /// This class contains all the information necessary for completing the move action.
    /// </summary>
    public class MoveAction
    {

        private Item mItem;
        Drawer fromLocation;
        Drawer toLocation;

        public MoveAction(string itemName, string[] fromLocation, string[] toLocation)
        {
            this.mItem = new Item(itemName);

            this.fromLocation = new Drawer(Int32.Parse(fromLocation[0]), Int32.Parse(fromLocation[1]));
            this.toLocation = new Drawer(Int32.Parse(toLocation[0]), Int32.Parse(toLocation[1]));
        }

        public Item MItem
        {
            get { return this.mItem; }
        }

        public Drawer FromLocation
        {
            get { return this.fromLocation; }
        }

        public Drawer ToLocation
        {
            get { return this.toLocation; }
        }

    }

    /// <summary>
    /// Class HardwareAction contains the information necessary completing actions in relation to hardware in the system.
    /// Note: this might need to change in the future to reflect other hardware actions the user might request.
    /// </summary>
    public class HardwareAction
    {

        int LED;
        //private bool testLights;
        private LED selectedLED;
        private Constants.LEDActionCodes state;

        /// <summary>
        /// Constructor. 
        /// </summary>
        public HardwareAction(LED led)
        {
            //this.testLights = true;
            selectedLED = led;
            this.state = Constants.LEDActionCodes.ON_OR_OFF;
        }

        public HardwareAction(Constants.LEDActionCodes state)
        {
            selectedLED = null;
            this.state = state;
        }

        /*
        /// <summary>
        /// If TestLights value is true then the Hardware Action selected was the Test All Lights action.
        /// </summary>
        public bool TestLights
        {
            get { return testLights; }
        }
        */

        public Constants.LEDActionCodes State
        {
            get { return state; }
        }

        public LED led
        {
            get { return selectedLED; }
        }


    }

    public class ActivateMicAction
    {
        private bool activateMic;

        public ActivateMicAction()
        {
            activateMic = true;

        }

        public bool ActivateMic
        {
            get { return activateMic; }
        }
    }

    public class DeactivateMicAction
    {
        private bool deactivateMic;

        public DeactivateMicAction()
        {
            deactivateMic = true;

        }

        public bool ActivateMic
        {
            get { return deactivateMic; }
        }
    }

    public class CloseAction
    {
        public CloseAction()
        {
            //Nothing here.
        }
    }

    #endregion

}
